package org.lego4j.internal;

import org.springframework.aop.Advisor;
import org.springframework.aop.framework.ProxyFactory;

public class ProxyFactoryAddAdvicePolicy implements IAddAdvicePolicy {

    private final ProxyFactory myProxyFactory;

    /**
     * @param theProxyFactory The proxy factory this class will delegate to add a new advisor.
     */
    public ProxyFactoryAddAdvicePolicy(ProxyFactory theProxyFactory) {
        myProxyFactory = theProxyFactory;
    }

    public void doAddAdvisor(Object theBean, Advisor theAdvisor) {
        myProxyFactory.addAdvisor( theAdvisor );
    }

}
